using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Diagnostics;
using Xfinity.Settings;
//using Xfinity.Engine;

namespace Xfinity.Settings
{
    public static class EngineSettings
    {
        #region Console key
        /// <summary>
        /// Returns the default console key.
        /// </summary>
        public static Keys ConsoleKey
        {
            [DebuggerStepThrough]
            get { return AllSettings.Default.ConsoleKey; }
            [DebuggerStepThrough]
            set { AllSettings.Default.ConsoleKey = value; AllSettings.Default.Save(); }
        }
        #endregion
        #region Console colour
        private static Color consoleColour;
        [DebuggerStepThrough]
        public static Color GetConvertedConsoleColour()
        {
            return consoleColour;
        }
        /// <summary>
        /// 
        /// </summary>
        public static string ConsoleColour
        {
            [DebuggerStepThrough]
            get { return consoleColour.ToString(); }
            [DebuggerStepThrough]
            set
            {
                string[] components = value.Split('{', ',', '}', ' ');
                float r = Convert.ToSingle(components[0]);
                float g = Convert.ToSingle(components[1]);
                float b = Convert.ToSingle(components[2]);
                consoleColour = new Color(new Microsoft.Xna.Framework.Vector3(r, g, b));
            }
        }
        #endregion
        #region GarbageCollectionNotificationEnabled
        /// <summary>
        /// GarbageCollectionNotificationEnabled.
        /// </summary>
        public static bool GarbageCollectionNotificationEnabled
        {
            get { return AllSettings.Default.GarbageCollectionNotificationEnabled; }
            set { AllSettings.Default.GarbageCollectionNotificationEnabled = value; }
        }

        #endregion
        #region ExternalForcesEnabled

        /// <summary>
        /// ExternalForcesEnabled.
        /// </summary>
        public static bool ExternalForcesEnabled
        {
            get { return AllSettings.Default.ExternalForcesEnabled; }
            set { AllSettings.Default.ExternalForcesEnabled = value; }
        }

        #endregion
        #region Save
        public static void Save()
        {
            AllSettings.Default.Save();
        }
        #endregion
        #region PlayerName

        /// <summary>
        /// PlayerName.
        /// </summary>
        public static string PlayerName
        {
            get { return AllSettings.Default.PlayerName; }
            set { AllSettings.Default.PlayerName = value; }
        }

        #endregion
        #region VSync


        /// <summary>
        /// VSync.
        /// </summary>
        public static bool VSync
        {
            get { return AllSettings.Default.VSync; }
            set { AllSettings.Default.VSync = value; }
        }

        #endregion
        #region AASampleType

        /// <summary>
        /// AASampleType.
        /// </summary>
        public static MultiSampleType AASampleType
        {
            get { return AllSettings.Default.AASampleType; }
            set { AllSettings.Default.AASampleType = value; }
        }

        #endregion
        #region Get/Set settings
        /// <summary>
        /// Sets a setting.
        /// </summary>
        /// <param name="setting">The setting.</param>
        /// <param name="data">The data.</param>
        public static void SetSetting(string setting, object data)
        {
            AllSettings.Default[setting] = data;
        }
        /// <summary>
        /// Gets a setting.
        /// </summary>
        /// <typeparam name="T">The setting type.</typeparam>
        /// <param name="setting">The setting.</param>
        /// <returns>The data.</returns>
        public static T GetSetting<T>(string setting)
        {
            T t = (T)AllSettings.Default[setting];
            return t;
        }
        #endregion
        #region Antialiasing
        /// <summary>
        /// Antialiasing.
        /// </summary>
        public static bool AntiAliasing
        {
            [DebuggerStepThrough]
            get { return AllSettings.Default.AntiAliasing; }
            [DebuggerStepThrough]
            set
            {
                AllSettings.Default.AntiAliasing = value;
            }
        }
        #endregion
    }
}